{{include file="public/header" /}}

<!-- header top nav -->
{{include file="public/header_top_nav" /}}

<!-- search -->
{{include file="public/nav_search" /}}

<!-- header nav -->
{{include file="public/header_nav" /}}

<!-- goods category -->
{{include file="public/goods_category" /}}

<!-- content -->
<div class="am-container user-main">

    <!-- user menu start -->
    {{include file="public/user_menu" /}}
    <!-- user menu end -->

    <!-- content start -->
    <div class="user-content">
        <div class="user-content-body">
            <!-- form start -->
            <form class="am-form form-validation form-search" method="post" action="{{:MyUrl('index/orderaftersale/index')}}" request-type="form">
                <div class="thin">
                    <div class="am-input-group am-input-group-sm am-fl so">
                        <input type="text" autocomplete="off" name="keywords" class="am-radius" placeholder="订单号" value="{{if !empty($params.keywords)}}{{$params.keywords}}{{/if}}" />
                        <span class="am-input-group-btn">
                            <button class="am-btn am-btn-default am-radius" type="submit" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
                        </span>
                    </div>
                    <label class="am-fl thin_sub more-submit">
                        更多筛选条件
                        {{if isset($params['is_more']) and $params['is_more'] eq 1}}
                            <input type="checkbox" name="is_more" value="1" id="is_more" checked />
                            <i class="am-icon-angle-up"></i>
                        {{else /}}
                            <input type="checkbox" name="is_more" value="1" id="is_more" />
                            <i class="am-icon-angle-down"></i>
                        {{/if}}
                    </label>
                </div>
                <table class="so-list more-where {{if !isset($params['is_more'])}}none{{/if}}">
                    <tbody>
                        <tr>
                            <td>
                                <span>类型：</span>
                                <select name="type" class="chosen-select" data-placeholder="类型...">
                                    <option value="-1">类型...</option>
                                    {{if !empty($common_order_aftersale_type_list)}}
                                        {{foreach $common_order_aftersale_type_list as $v}}
                                            <option value="{{$v.value}}" {{if isset($params['type']) and $params['type'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
                                        {{/foreach}}
                                    {{/if}}
                                </select>
                            </td>
                            <td>
                                <span>状态：</span>
                                <select name="status" class="chosen-select" data-placeholder="状态...">
                                    <option value="-1">状态...</option>
                                    {{if !empty($common_order_aftersale_status_list)}}
                                        {{foreach $common_order_aftersale_status_list as $v}}
                                            <option value="{{$v.value}}" {{if isset($params['status']) and $params['status'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
                                        {{/foreach}}
                                    {{/if}}
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span>退款：</span>
                                <select name="refundment" class="chosen-select" data-placeholder="退款...">
                                    <option value="-1">退款...</option>
                                    {{if !empty($common_order_aftersale_refundment_list)}}
                                        {{foreach $common_order_aftersale_refundment_list as $v}}
                                            <option value="{{$v.value}}" {{if isset($params['refundment']) and $params['refundment'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
                                        {{/foreach}}
                                    {{/if}}
                                </select>
                            </td>
                            <td>
                                <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
                                <a href="{{:MyUrl('index/orderaftersale/index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </form>
            <!-- form end -->

            <!-- 列表 -->
            <div class="data-list am-margin-top-sm">
                <table class="am-table am-table-striped">
                    <thead>
                        <tr>
                            <th class="row-goods am-hide-sm-only">商品信息</th>
                            <th class="row-apply">申请信息</th>
                            <th class="am-hide-sm-only">凭证</th>
                            <th>状态</th>
                            <th class="am-hide-sm-only">快递信息</th>
                            <th class="row-operation">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {{if !empty($data_list)}}
                            {{foreach $data_list as $v}}
                                <tr>
                                    <td class="am-hide-sm-only">
                                        <div class="goods-detail">
                                            <a href="{{$v.order_data.items.goods_url}}" target="_blank">
                                                <img src="{{$v.order_data.items.images}}" alt="{{$v.order_data.items.title}}" class="am-img-thumbnail am-radius" />
                                            </a>
                                            <div class="goods-base">
                                                <a href="{{$v.order_data.items.goods_url}}" target="_blank" class="goods-title">{{$v.order_data.items.title}}</a>
                                                {{if !empty($v.order_data.items.spec)}}
                                                    <ul class="goods-attr">
                                                        {{foreach $v.order_data.items.spec as $spec}}
                                                            <li>{{$spec.type}}：{{$spec.value}}</li>
                                                        {{/foreach}}
                                                    </ul>
                                                {{/if}}
                                            </div>
                                        </div>
                                        {{if $v.order_data.items.original_price gt 0}}
                                            <p class="original-price">{{$price_symbol}}{{$v.order_data.items.original_price}}</p>
                                        {{/if}}
                                        <p class="line-price">{{$price_symbol}}{{$v.order_data.items.price}} x {{$v.order_data.items.buy_number}}</p>
                                    </td>
                                    <td>
                                        类型：{{$v.type_text}}<br />
                                        原因：{{$v.reason}}<br />
                                        数量：{{$v.number}}<br />
                                        金额：<span class="am-text-danger">{{$price_symbol}}{{$v.price}}</span><br />
                                        说明：{{$v.msg}}<br />
                                        时间：{{$v.apply_time_time}}
                                    </td>
                                    <td class="am-hide-sm-only">
                                        {{if !empty($v['images'])}}
                                            <div data-am-widget="slider" class="am-slider am-slider-a1" data-am-slider='{&quot;directionNav&quot;:false, slideshow:false}' >
                                                <ul class="am-slides">
                                                    {{foreach $v.images as $img}}
                                                        <li>
                                                            <img src="{{$img}}" />
                                                        </li>
                                                    {{/foreach}}
                                                </ul>
                                            </div>
                                        {{/if}}
                                    </td>
                                    <td>
                                        <p>{{$v.status_text}}</p>
                                        {{if $v['status'] eq 3 and !empty($v['refundment_text'])}}
                                            <span class="am-badge am-badge-success am-margin-top-xs">{{$v.refundment_text}}</span>
                                        {{/if}}
                                        {{if $v['status'] eq 4 and !empty($v['refuse_reason'])}}
                                            <span class="am-text-danger">{{$v.refuse_reason}}</span>
                                        {{/if}}
                                    </td>
                                    <td class="am-hide-sm-only">
                                        {{if $v['type'] eq 1 and in_array($v['status'], [2,3])}}
                                            快递：{{$v.express_name}}<br />
                                            单号：{{$v.express_number}}<br />
                                            时间：{{$v.delivery_time_time}}
                                        {{/if}}
                                    </td>
                                    <td>
                                        {{if $v['status'] eq 1 and $v['type'] eq 1}}
                                            <a href="{{:MyUrl('index/orderaftersale/aftersale', ['oid'=>$v['order_id'], 'did'=>$v['order_detail_id'], 'is_auto_delivery'=>1])}}" target="_blank" class="am-btn am-btn-primary am-btn-xs am-radius am-icon-send am-btn-block"> 退货</a>
                                        {{/if}}
                                        {{if !in_array($v['status'], [3,5])}}
                                            <button type="button" class="am-btn am-btn-warning am-btn-xs am-radius am-icon-paint-brush am-btn-block submit-ajax submit-cancel" data-url="{{:MyUrl('index/orderaftersale/cancel')}}" data-id="{{$v.id}}" data-view="reload"> 取消</button>
                                        {{/if}}
                                        <a href="{{:MyUrl('index/orderaftersale/aftersale', ['oid'=>$v['order_id'], 'did'=>$v['order_detail_id']])}}" target="_blank" class="am-btn am-btn-default am-btn-xs am-radius am-icon-cubes am-btn-block"> 详情</a>
                                    </td>
                                </tr>
                            {{/foreach}}
                        {{/if}}
                    </tbody>
                </table>
                
                {{if empty($data_list)}}
                    <div class="table-no"><i class="am-icon-warning"></i> 没有相关数据</div>
                {{/if}}
            </div>

            <!-- 分页 -->
            {{if !empty($data_list)}}
                {{$page_html|raw}}
            {{/if}}
        </div>
    </div>
    <!-- content end -->
</div>

<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->